Bitset input fixes and refactoring
Input serialization fixes, refactroing