code cleanup and reformatting
fix NPE when searching from an external file
extract "user" atom as a constant