move method to views as functions