http://mths.be/osx - ripped it off