Refactor + use rescue in top-level for errors