updated signatures and fixed STDIN bug