cleaned up and working somewhat