Code from the codecademy.com website, this is my personal interpretation of the exercises.