Working. Still missing proper memory clean-up and profiling.