Cleaned up the code a small bit. Fixed comments etc.