Added commenting, removed spaghetti code from development.