Made "dirty hack" more pythonic.