Fixed array-size bug, began major overhaul of source code