cleanup code a bit

Some formatting, some logic