make variable resolution strict and reorganize code
fix grammar patterns, simplify modules and compile func declaration paths