Improve getSingle logic