Resolution for issue  #757

Not the prettiest implementation, however it does work. Any refactoring ideas welcomed.