cleaned up code more