Speed improvements: page generate much faster, still need to cleanup some functions