cleaned up code, but not ready yet