Logic moved to functions, view - to index