Cleaned up code, e.g. comments and indenting