Added comments, proper code style etc.