general: general bugfixes and restructured input handling