cleaned up main file and added method docs