Implemented basic functionality. Not working smoothly yet.