Solving some problems; mostly in ruby