refactored fragment class for use with cast plugin