Minor refactor + consistent style on errors