Almost Done. Just a little memory leak yet to be fixed