fixed issue 1, still need to be refactored