fixed extra jars and refactored the code