Minor edits. Code working ok