Reduced memory usage

Hopefully this will speed up the code a bit and result in less
OutOfMemoryErrors
separate out CardFactory