Added a few explicit casts - don't like to rely on implicit