Code fixed and seperated. Tests added