Restored old code a bit