removed dir
reordered functions for dependancy