Almost working... removed some useless code