a to function for task, which doesn't work for negative number
many fixes
further fixes