Cleaned up a lot, should worrk properly for most everything now