added first algorithm, updated main