Clean up code
Mass loop almost works