implement action main functionality
some changes and simplifications