bugs fixes + pretty input