Expanded code a bit