Added hosted content support, global refactoring