turned off debugging
refactored, cleaned up