Fixed sytax and logical errors. Best wishes on playing with it. May be updated in the future.