refactor and added empty view