Don't mind the code quality -- it's written in about 2 or 3 hours.