fix for '-f' switch + minor cleanup