Refactor a bit, add F solution