First working version. It still is pretty hackish though.

Signed-off-by: Maël Cournoyer-Michel <emerald000@hotmail.com>