style clean and added empty pos check