Edited fragment implemetation to allow for changing of fragments on the
fly.