refactor controls calculations