refactor, using beans and lock in view controller