Fixed paths, added functions and index templates