fixed last action
added sorting