Merge pull request #177 from aarizkuren/master

Some fixes and code-refactored on media preview functions.