Reduced the size, fixed bugs, reworded error messages