Cleaned up frame initialization code