Adding media.rb file and seperating some logic between base and media.