refactored for autolayout