merge with powmedia

refactoring + unit tests