Fix performance problem

Media files were loaded from server while each request but should be loaded only once
added additional verification for that
Merge pull request #1 from vdubyna/master

Fix performance problem