Cleaned, and added some documentation