Removed some stupid bugs from first version