Refactored code

Also changed CGImageRef to NSImage.
Updated close layer to close on mouseUp
New .gitignore