First commit, adapted to work in Elgg platform