Initial commit.

Sources taken from fengine project.
Adapted to match the specific application.