more error stuff + some variable/structure abstraction