Initial branch commit
Tried refactoring loop functions
Minor