Now gets frames correctly. Cleans up a bit.