simplified printInBinary function
fixed formatting