I will attempt to implement the following solution: http://stackoverflow.com/a/4842961/627806