removed redundant methods. chancged control flow.