Changed the close (X) location, looks better left and code readability improvements and whitespace cleanup.