cleaned up code