Mpfs file size fixed
Improved template loops parse
Used str_replace instead of substr where it makes sense