Added double loading and bug fixing