cleaned up fixed code