fixed bugs, cleaned up the code, created error.html, improved layout for invoice