Refactored some items and added some documentation