used wiki
refactored and added out file