cleaned up code some