Added control files
Converted indentation and move some code around