removed duplicated code, added new action functionality