Implemented all major functions