Finished programming

All functions implemented and code cleanup