updated access modifiers and rearranged code base