Speed up code - refactor of Scope and Controller