Some optimizations and adding functional (v0.0.4)