EDIT: Stripped off unnecessary code.