Move view functions inside constructor.