Implemented all required functionality.