Moved logic from lib to action + misc fixes