refactor, media changes, code cleanup