Removed an old workaround and refactored.