Clean up a lot. Removed duplicated functions and added skeletons