cleaned up code, removed extraneous functions