Some improvements and cleanup

Locally returns a proper value
Use stderr for output of locally.