cleaned and reset to pre-dilini's pull request