Added generic errors and base logic