merged Godwinh and Charly's code