Solved some more bugs and improved the verify function