Cleaned up dupes and annotated code better